<?php
//
// +------------------------------------------------------------------------+
// | PHP Version 5.4                                                        |
// +------------------------------------------------------------------------+
// | Copyright (c) All rights reserved.                                     |
// +------------------------------------------------------------------------+
// | 世纪车来车往(北京）网络科技有限公司 版权所有！                         |
// | TEL:010-63732365  HOTLINE:400-6688-365  EMAIL:clcw@clcw.com.cn         |
// | $Revision: 1.0 $                                                       |
// +------------------------------------------------------------------------+
// | Author: songaimin@clcw.com.cn  Blog:http://blog.csdn.net/samxx8        |
// +------------------------------------------------------------------------+
//

namespace AuctionCore\System;

/**
* 来拍车APP设备操作类
* @author   sam 
*/
class AppDevice {
    
    /*
    * @param $info{
                  dev_uuid   //设备id
                  ,dev_uid   //用户id
                  ,dev_jpush_id  //极光推送平台id
                  }
    * @return null
    */
    public function save($info){

        if(!$info['dev_uuid'] || !$info['dev_uid'] || !$info['dev_jpush_id'] )
            return false;

        $row = M('app_devices')->where('dev_jpush_id="'.$info['dev_jpush_id'].'" AND dev_uid="'.$info['dev_uid'].'" AND dev_uuid="'.$info['dev_uuid'].'"')->find();
        if(!$row){
            $info['dev_create_time'] = date('Y-m-d H:i:s');
            $info['dev_type'] = strlen($info['dev_uuid'])>15?2:1;
            $ok = M('app_devices')->add($info);     
            return $ok;
        }
        return false;
    }




}

?>